import request from '@/utils/request'
import type {
  HospitalDdetailResponseData,
  DepartmentResponseData,
  BookingScheduleResponseData
} from './type'

enum API {
  GETDETAILINFO_URL = '/api/hosp/hospital/',
  GETDEPARTMENT_URL = '/api/hosp/hospital/department/',
  GETSCHEDULE_URL = '/api/hosp/hospital/auth/getBookingScheduleRule/'
}

// 获取医院详情信息
export const getHospitalDetailService = (hoscode: string) =>
  request.get<any, HospitalDdetailResponseData>(API.GETDETAILINFO_URL + hoscode)

// 获取医院科室列表
export const getHospitalDepartmentService = (hoscode: string) =>
  request.get<any, DepartmentResponseData>(API.GETDEPARTMENT_URL + hoscode)

// 获取预约挂号数据
export const getBookingScheduleService = (
  hoscode: string,
  depcode: string,
  page: number,
  limit: number
) =>
  request.get<any, BookingScheduleResponseData>(
    API.GETSCHEDULE_URL + `${page}/${limit}/${hoscode}/${depcode}`
  )
